// Source File Name:   Deprecated.java

package com.vhly.classfile;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

// Referenced classes of package com.vhly.classfile:
//            Attribute

public class Deprecated
        implements Attribute {

    private int name_index;
    private int data_len;
    private byte buf[];

    public Deprecated() {
        name_index = 0;
        data_len = 0;
    }

    public void setNameIndex(int i) {
        name_index = i;
    }

    public int getNameIndex() {
        return name_index;
    }

    public void setDataLen(int i) {
        data_len = i;
    }

    public int getDataLen() {
        return data_len;
    }

    public void read(DataInputStream datainputstream, boolean flag)
            throws IOException {
        if (flag)
            name_index = datainputstream.readUnsignedShort();
        data_len = datainputstream.readInt();
        if (data_len == 0) {
            return;
        } else {
            buf = new byte[data_len];
            datainputstream.read(buf, 0, buf.length);
            return;
        }
    }

    public void write(DataOutputStream dataoutputstream)
            throws IOException {
        dataoutputstream.writeShort(name_index);
        dataoutputstream.writeInt(data_len);
        if (data_len == 0) {
            return;
        } else {
            dataoutputstream.write(buf, 0, buf.length);
            return;
        }
    }

    public int getType() {
        return 7;
    }
}